package com.imohoo.shanpao.request;

import com.imohoo.libs.converter.CMD;
import com.imohoo.libs.converter.OPT;
import com.imohoo.libs.converter.SpFile;
import com.imohoo.libs.converter.SpRequest;
import com.imohoo.libs.converter.SpResponse;
import com.imohoo.shanpao.FileUploadResponse;

import java.util.HashMap;
import java.util.Map;

import okhttp3.MultipartBody;
import okhttp3.RequestBody;
import retrofit2.Call;
import retrofit2.http.Body;
import retrofit2.http.FieldMap;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.Multipart;
import retrofit2.http.POST;
import retrofit2.http.Part;
import retrofit2.http.PartMap;

/**
 * Created by zhaobo on 2017/1/3.
 */

public interface ShanpaoService {

    String UPLOAD_PHP = "upload.php";

    /**
     * 需要自己加密params
     * 使用FieldMap 需要 设置 FormUrlEncoded
     *
     * @param params
     * @return
     */
    @FormUrlEncoded
    @POST("/")
    Call<SpResponse<HashMap>> listZan(@FieldMap Map<String, Object> params);

    @Multipart
    @POST("upload.php")
    Call<FileUploadResponse> uploadFile(@Part MultipartBody.Part file, @PartMap Map<String, RequestBody> params);

    @POST(UPLOAD_PHP)
    Call<FileUploadResponse> uploadFile2(@Body SpFile typedFile);

    /**
     * @param params
     * @return
     */
    @POST("/")
    Call<SpResponse<HashMap>> listZan1(@Body SpRequest params);

    @POST("/")
    @CMD("SnsApi")
    @OPT("getUserHitsList")
    Call<SpResponse<HashMap>> listZan2(@Body SpRequest params);
}